package com.hzw.saas.service.project.enums;

import java.util.Objects;

/**
 * @author zzl
 * @since 08/11/2021
 */
public enum AttachmentType {

    RESEARCH_PLAN(1, "研究方案"),
    RESUME(2, "申请人简历"),
    MAGNUM_OPUS(3, "代表性论著"),
    ACCEPTANCE_INSTRUCTION(4,"验收申请说明附件"),
    ACCEPTANCE_REPORT(5,"项目验收报告"),
    RESEARCH_PAPER(6, "研究成果论文"),
    PROJECT_CONTRACT(7, "横向项目合同"),
    CALCULATE_DATA(8, "文章原始计算数据"),
    ;

    public static final String API_TEXT = "1-研究方案, 2-申请人简历, 3-代表性论著，4-验收申请其他材料，5-项目验收报告，6-研究成果论文，7-横向项目合同，8-文章原始计算数据";

    private final Integer code;
    private final String text;

    AttachmentType(Integer code, String text) {
        this.code = code;
        this.text = text;
    }

    public Integer code() {
        return code;
    }

    public String text() {
        return text;
    }

    public static AttachmentType instance(Integer code) {
        for (AttachmentType value : AttachmentType.values()) {
            if (Objects.equals(value.code(), code)) {
                return value;
            }
        }
        return null;
    }

}
